package cn.com.cetccst.mdmdemo;

import android.app.Application;
import android.util.Log;

import com.zdk.mdm.engine.MdmDeviceAdminReceiver;

import cn.com.cetccst.mdm.engine.BaseMDMEngine;
import cn.com.cetccst.mdm.MDMManager;
import cn.com.cetccst.mdmdemo.utils.ThreadSafeToast;

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        ThreadSafeToast.init(this);
        MDMManager.init(this, MdmDeviceAdminReceiver.getComponentName(this),
                getPackageName() + ".provider", new BaseMDMEngine.Callback() {
                    @Override
                    public void log(String msg) {
                        Log.e("mdm_engine", msg);
                    }
                });
        Log.e("TraceL", "mdm engine is " + MDMManager.getInstance().getMdmName());
        //if(Build.BRAND.equalsIgnoreCase("RedMi")
        //|| Build.BRAND.equalsIgnoreCase("XiaoMi")) {
        //    IntentFilter intentFilter = new IntentFilter();
        //    intentFilter.addAction("com.miui.enterprise.ACTION_VOLUME_DOWN_DOWN");
        //    intentFilter.addAction("com.miui.enterprise.ACTION_VOLUME_DOWN_UP");
        //    registerReceiver(new BroadcastReceiver() {
        //        @Override
        //        public void onReceive(Context context, Intent intent) {
        //            ThreadSafeToast.show("音量下按键按下");
        //        }
        //    }, intentFilter);
        //}
    }
}
